package com.sltx.util.http;/*
package com.sltx.util.http;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class CommonUtils {

	public static void JsonObject2HashMap(JSONObject jo, List<Map<?, ?>> rstList) {
		for (Iterator<String> keys = jo.keys(); keys.hasNext();) {
			try {
				String key1 = keys.next();
				System.out.println("key1---" + key1 + "------" + jo.get(key1) + (jo.get(key1) instanceof JSONObject) + jo.get(key1) + (jo.get(key1) instanceof JSONArray));
				if (jo.get(key1) instanceof JSONObject) {

					JsonObject2HashMap((JSONObject) jo.get(key1), rstList);
					continue;
				}
				if (jo.get(key1) instanceof JSONArray) {
					JsonArray2HashMap((JSONArray) jo.get(key1), rstList);
					continue;
				}
				System.out.println("key1:" + key1 + "----------jo.get(key1):" + jo.get(key1));
				json2HashMap(key1, jo.get(key1), rstList);

			} catch (JSONException e) {
				e.printStackTrace();
			}

		}

	}

	public static void JsonArray2HashMap(JSONArray joArr, List<Map<?, ?>> rstList) {
		for (int i = 0; i < joArr.length(); i++) {
			try {
				if (joArr.get(i) instanceof JSONObject) {

					JsonObject2HashMap((JSONObject) joArr.get(i), rstList);
					continue;
				}
				if (joArr.get(i) instanceof JSONArray) {

					JsonArray2HashMap((JSONArray) joArr.get(i), rstList);
					continue;
				}
				System.out.println("Excepton~~~~~");

			} catch (JSONException e) {
				e.printStackTrace();
			}

		}

	}

	public static void json2HashMap(String key, Object value, List<Map<?, ?>> rstList) {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put(key, value);
		rstList.add(map);
	}

	*/
/**
	 * JsonObject 转map
	 * @throws JSONException 
	 * *//*

	public static Map parserToMap(JSONObject json) throws JSONException{  
	    Map map=new HashMap();  
//	    JSONObject json=JSONObject.fromObject(s);  
	    Iterator keys=json.keys();  
	    while(keys.hasNext()){  
	        String key=(String) keys.next();  
	        String value=json.get(key).toString();  
//	        if(value.startsWith("{")&&value.endsWith("}")){  
//	            map.put(key, parserToMap(value));  
//	        }else{  
//	            map.put(key, value);  
//	        }  
	        map.put(key, value);
	    }  
	    return map;  
	}  
	
	public static List<Map<String,Object>> proAllJsonData(JSONObject jsonObject,int type){
        List<Map<String,Object>> listData = new ArrayList<Map<String,Object>>();
        if(jsonObject!=null){
            try {
            	JSONArray jsonArray = jsonObject.getJSONArray("RESULTDATA");
                if(jsonArray==null){
                    return null;
                }
                Map<String,Object> map = null;
                for(int i=0;i<jsonArray.length();i++){
                	JSONObject jsonObject2 = (JSONObject)jsonArray.opt(i);
                	map = new HashMap<String,Object>();
                	if(type == 1){    
                		map.put("ENTNAME", jsonObject2.getString("ENTNAME"));
                        map.put("REGNO", jsonObject2.getString("REGNO"));
                        map.put("ESDATE", jsonObject2.getString("ESDATE"));
                        map.put("FRDB", jsonObject2.getString("FRDB"));
                        map.put("DOM", jsonObject2.getString("DOM")); 
                        map.put("OLDNAME", jsonObject2.getString("OLDNAME"));                                         
                        map.put("S_EXT_NODENUM", jsonObject2.getString("S_EXT_NODENUM"));
                        map.put("SHXYDM", jsonObject2.getString("SHXYDM"));
                 	}
                	else if(type == 3){    
                		map.put("INV", jsonObject2.getString("INV"));                                         
                        map.put("INVTYPE", jsonObject2.getString("INVTYPE"));
                        map.put("REGNO", jsonObject2.getString("REGNO"));
                        map.put("SUBCONAM", jsonObject2.getString("SUBCONAM"));
                        map.put("CURRENCY", jsonObject2.getString("CURRENCY"));
                        map.put("ZB_NEW", jsonObject2.getString("ZB_NEW"));
                	}else if(type == 4){
                		map.put("ENTNAME", jsonObject2.getString("ENTNAME"));                                         
                        map.put("REGCAP", jsonObject2.getString("REGCAP"));
                        map.put("REGCAPCUR", jsonObject2.getString("REGCAPCUR"));
                        map.put("SUBCONAM", jsonObject2.getString("SUBCONAM"));
                        map.put("CURRENCY", jsonObject2.getString("CURRENCY"));
                        map.put("ZB", jsonObject2.getString("ZB"));
                        map.put("ENTSTATUS", jsonObject2.getString("ENTSTATUS"));
                        map.put("ESDATE", jsonObject2.getString("ESDATE"));
                        map.put("ENTTYPE", jsonObject2.getString("ENTTYPE"));
                	}else if(type == 5){
                		map.put("ENTNAME", jsonObject2.getString("ENTNAME"));                                         
                        map.put("ESDATE", jsonObject2.getString("ESDATE"));
                        map.put("ENTSTATUS", jsonObject2.getString("ENTSTATUS"));
                        map.put("REGNO", jsonObject2.getString("REGNO"));
                        map.put("REGORG", jsonObject2.getString("REGORG"));
                        map.put("FZ_S_EXT_NODENUM", jsonObject2.getString("FZ_S_EXT_NODENUM"));
                	}else if(type == 6){
                		map.put("NAME", jsonObject2.getString("NAME"));                                         
                        map.put("POSITION", jsonObject2.getString("POSITION"));
                        map.put("LEREPSIGN", jsonObject2.getString("LEREPSIGN"));
                    }else{
                    	map.put("FZL_MC", jsonObject2.getString("FZL_MC"));                                         
                        map.put("FSQ_SQH", jsonObject2.getString("FSQ_SQH"));
                        map.put("FZL_SQR", jsonObject2.getString("FZL_SQR"));
                        map.put("FZL_ZLLX", jsonObject2.getString("FZL_ZLLX"));                                         
                        map.put("FZL_GKGGH", jsonObject2.getString("FZL_GKGGH"));
                        map.put("FZL_GKGGR", jsonObject2.getString("FZL_GKGGR"));                      
                        map.put("FZL_ZFLH_C", jsonObject2.getString("FZL_ZFLH_C"));                                         
                        map.put("FZL_FLH", jsonObject2.getString("FZL_FLH"));
                        map.put("FZL_ZFLH", jsonObject2.getString("FZL_ZFLH"));
                        map.put("FZL_SQZLQR", jsonObject2.getString("FZL_SQZLQR"));                      
                        map.put("FZL_FMSJR", jsonObject2.getString("FZL_FMSJR"));                                         
                        map.put("FFL_FLZT", jsonObject2.getString("FFL_FLZT"));
                        map.put("FVL_VALIDITY", jsonObject2.getString("FVL_VALIDITY"));
                    }
                    listData.add(map);
                }
            } catch (Exception e) {
                
            }
        }
        return  listData;
    }
	
	public static Map<String,Object> proJsonData(JSONObject jsonObject,int type){
    	Map<String,Object> map = new HashMap<String,Object>();
        if(jsonObject!=null){
            try {
                //节点
                JSONArray jsonArray = jsonObject.getJSONArray("RESULTDATA");
                if(jsonArray==null){
                    return null;
                }
                if(jsonArray != null && jsonArray.length() > 0){
                    JSONObject jsonObject2 = (JSONObject)jsonArray.opt(0);
                    map.put("ENTNAME", jsonObject2.getString("ENTNAME"));
                    map.put("REGNO", jsonObject2.getString("REGNO"));
                    map.put("ESDATE", jsonObject2.getString("ESDATE"));
                    map.put("FRDB", jsonObject2.getString("FRDB"));
                    map.put("DOM", jsonObject2.getString("DOM")); 
                    if(type == 1){                    	
                        map.put("OLDNAME", jsonObject2.getString("OLDNAME"));                                         
                        map.put("S_EXT_NODENUM", jsonObject2.getString("S_EXT_NODENUM"));
                        map.put("SHXYDM", jsonObject2.getString("SHXYDM"));
                    }else{                    	
                        map.put("ENTSTATUS", jsonObject2.getString("ENTSTATUS"));
                        map.put("REGCAP", jsonObject2.getString("REGCAP"));                    
                        map.put("ENTTYPE", jsonObject2.getString("ENTTYPE"));
                        map.put("OPSCOPE", jsonObject2.getString("OPSCOPE"));
                        map.put("REGORG", jsonObject2.getString("REGORG"));
                    }
                    
                }
            } catch (Exception e) {
                
            }
        }
        return  map;
    }
}
*/
